package com.lovo.psc.controller;


import com.lovo.psc.Uto.BookBean;
import com.lovo.psc.entity.SupplierPurchase;
import com.lovo.psc.entity.Triumph;
import com.lovo.psc.service.ISupplierPurchaseService;
import com.lovo.psc.service.IVieBookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lovo
 * @since 2022-07-08
 */
@Api(tags = "刘英旭")
@RestController
@RequestMapping("/SupplierPurchaseController")
public class SupplierPurchaseController {
    @Autowired
    private ISupplierPurchaseService iSupplierPurchaseService;

    @Autowired
    private IVieBookService service;

    @PostMapping("addBookPrice")
    @ApiOperation(value = "报价")
    public void addBookPrice(SupplierPurchase supplierPurchase) {
        iSupplierPurchaseService.addBookPrice(supplierPurchase);
    }

    @PutMapping("upDateNumStateBy/{BookNumber}/{supplierNumber}")
    @ApiOperation(value = "根据标书编号中标")
    public void upDateNumStateBy(@PathVariable("BookNumber") Integer BookNumber, @PathVariable("supplierNumber") Integer supplierNumber) {
        iSupplierPurchaseService.upDateNumStateBy(BookNumber, supplierNumber);
    }

    @ApiOperation(value = "查询所有标书")
    @GetMapping("findListBookBean/{number}/{id}")
    public List<BookBean> findListBookBean(@PathVariable("number") String number, @PathVariable("id") String id) {
        return service.findListBookBean(number, id);
    }

    @ApiOperation(value = "审核系统放弃采购")
    @PutMapping("del/{number}")
    public void del(@PathVariable("number") Integer BookNumber) {
        iSupplierPurchaseService.del(BookNumber);
    }

    @ApiOperation(value = "查询标书")
    @GetMapping("findBookByTriumphSupplierNumber/{BookNumber}/{supplierNumber}")
    public Triumph findBookByTriumphSupplierNumber(Integer BookNumber, Integer supplierNumber) {
        return iSupplierPurchaseService.findBookByTriumphSupplierNumber(BookNumber, supplierNumber);
    }
}
